﻿@model ProductOverviewModel
@using Nop.Core.Domain.Orders
@using Nop.Web.Models.Catalog;
@{
    //prepare "Add to cart" AJAX link
    string addtocartlink = "";
    var shoppingCartTypeId = (int)ShoppingCartType.ShoppingCart;
    var quantity = 1;
    if (Model.ProductPrice.ForceRedirectionAfterAddingToCart)
    {
        addtocartlink = Url.RouteUrl("AddProductToCart", new { productId = Model.Id, shoppingCartTypeId = shoppingCartTypeId, quantity = quantity, forceredirection = Model.ProductPrice.ForceRedirectionAfterAddingToCart });
    }
    else
    {
        addtocartlink = Url.RouteUrl("AddProductToCart", new { productId = Model.Id, shoppingCartTypeId = shoppingCartTypeId, quantity = quantity, });
    }    
}
<div data-productid="@Model.Id">
    <div class="image">
        <span>
            <a style="height:256px" href="@Url.RouteUrl("Product", new { SeName = Model.SeName })" title="@Model.DefaultPictureModel.Title">
                <img alt="@Model.DefaultPictureModel.AlternateText" src="@Model.DefaultPictureModel.ImageUrl" title="@Model.DefaultPictureModel.Title" />
            </a>
       </span>
    </div>
    <div class="name">
        <a href="@Url.RouteUrl("Product", new { SeName = Model.SeName })">@Model.Name</a>
    </div>
    <div class="description">
        @Html.Raw(Model.ShortDescription)
    </div>
    <div class="price">
        @if (!String.IsNullOrEmpty(Model.ProductPrice.OldPrice))
        {
            <span class="price old-price">@Model.ProductPrice.OldPrice</span>
        }
        <span class="price actual-price">@Model.ProductPrice.Price</span>
    </div>
    <div class="cart">
        @*<input type="button" value="@T("Products.Details")" class="button-1 product-box-detail-button" onclick="setLocation('@Url.RouteUrl("Product", new { SeName = Model.SeName })')" />*@
        @if (!Model.ProductPrice.DisableBuyButton)
        {
            <input type="button" value="@(Model.ProductPrice.AvailableForPreOrder ? T("ShoppingCart.PreOrder") : T("ShoppingCart.AddToCart"))" class="button" onclick="AjaxCart.addproducttocart('@addtocartlink    ');return false;" />
        }
    </div>
    @Html.Widget("productbox_add_info")

</div>
